package com.jt.provider.controller;

import com.jt.provider.service.ResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/provider")
public class ProviderSentinelController {
    @GetMapping("/sentinel01")
    public String doSentinel01(){
        return "sentinel01 test .....";
    }
    @GetMapping("/sentinel02")
    public String doSentinel02(){
        return "sentinel 02 test  ...";
    }
    @Autowired
    private ResourceService resourceService;
    /**
     * 演示链路限流
     * @return
     */
    @GetMapping("/sentinel03")
    public String doSentinel03(){
        return resourceService.doGetResource();
        //return "sentinel 03 test";
    }

    @GetMapping("/sentinel06")
    public String doSentinel06(@RequestParam("id") Integer id){
        return resourceService.doGetResource(id);
        //return "Get Resource By "+id;
    }
}
